package pl.plesken.languages;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class SetLanguage {
	//private static final String BUNDLE_NAME = "pl.plesken.languages.Polski"; //$NON-NLS-1$

	//private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
	//		.getBundle(BUNDLE_NAME);
	
	private static String lang;

	public static String getLang() {
		return lang;
	}

	public static void setLang(String lang) {
		SetLanguage.lang = lang;
	}

	private SetLanguage() {
	}

/*	public static String getString(String key) {
		try {
			return RESOURCE_BUNDLE.getString(key);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}*/
	
	public static String getString(String key) {
		ResourceBundle LOCALE_BUNDLE = ResourceBundle.getBundle("pl.plesken.languages." + lang);
		try {
			return LOCALE_BUNDLE.getString(key);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}
}
